/**
 * Project Name:mms
 * File Name:MeetingController
 * Package Name:com.scb.dev.mms.controller
 * Date:2018/12/217:56
 * Copyright (c) 2018, Yuchuan.Dong All Rights Reserved.
 */
package com.scb.dev.mms.controller;

import com.scb.dev.mms.common.ResponseResult;
import com.scb.dev.mms.dto.BookMeetingDto;
import com.scb.dev.mms.dto.InsertMeetingDto;
import com.scb.dev.mms.service.IMeetingInfoService;
import com.scb.dev.mms.service.IMeetingRoomService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * ClassName: MeetingController <br/>
 * @Description: ${todo} ADD REASON(可选). <br/><br/>
 * @Date: 2018/12/2 17:56 <br/>
 *
 * @author Yuchuan.Dong
 * @version V1.0
 * @since JDK 1.8
 */
@RestController
@RequestMapping("/bm/meeting/")
@Api(value = "MeetingController", description = "meeting API")
public class MeetingController {
    @Resource
    private IMeetingRoomService iMeetingRoomService;

    @Resource
    private IMeetingInfoService iMeetingInfoService;

    /**
     * add book meeting
     * @param insertMeetingDto
     * @return
     */
    @RequestMapping(value = "meeting",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"})
    @ApiOperation(value = "bookMeeting", notes = "Use this API to book a new meeting.")
    public ResponseResult bookMeeting(@RequestBody @ApiParam(name = "insertMeetingDto", value = "insertMeetingDto entity")InsertMeetingDto insertMeetingDto){
        return iMeetingInfoService.insertMeetingInfo(insertMeetingDto);
    }

    /**
     * select someOne book meeting list
     * @param creatorName
     * @return
     */
    @RequestMapping(value = "meeting_list/{creatorName}",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
    @ApiOperation(value = "someone's booking meeting info", notes = "Check someone's booking for a meeting")
    public ResponseResult queryCustomBookMeetingInfo(@PathVariable("creatorName") @ApiParam(name = "creator name", value = "creator name") String creatorName){
        return iMeetingInfoService.queryBookMeetingInformation(creatorName);
    }

    /**
     * select available meeting time map
     * @param bookMeetingDto
     * @return
     */
    @RequestMapping(value = "meeting_room/time",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"})
    @ApiOperation(value = "query meeting room time", notes = "query available time of meeting room ")
    public ResponseResult queryAvailableMeetingRoomInfo(@RequestBody @ApiParam(name = "bookMeetingDto", value = "bookMeetingDto") BookMeetingDto bookMeetingDto){
        return iMeetingRoomService.queryAvailableMeetingRoomInfo(bookMeetingDto);
    }


    @RequestMapping(value = "meeting_room",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
    @ApiOperation(value = "find all", notes = "query all meeting room info")
    public ResponseResult queryAllMeetingRoom(){
        return iMeetingRoomService.queryAllMeetingRoom();
    }

}
